<?php

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/**
 * Description of ClientController
 *
 * @author julien
 */
class ClientController {

    public function processRequest() {
        switch (HTTPRequestModel::getInstance()->extractGETValue('action')){
            case 'AddClient':
                $this->addClient();
                break;
            case 'EditClient':
                $this->editClient();
                break;
            case 'DeleteClienty':
                $this->deleteClient();
                break;
            default:
                $this->listClients();
                break;
        }
    }
    
    
    public function addClient(){
        
    }
    
    public function editClient(){
        
    }
    
    public function deleteClient(){
        
    }
    
    public function listClients(){
         require_once 'Classes/View/Pages/ListBasedPage.php';
         if(strtolower(HTTPRequestModel::getInstance()->getRequest()) == "post"){
             
         }
         else if(strtolower(HTTPRequestModel::getInstance()->getRequest()) == "get") {
            $clientList;
            try{ 
                $clientList = ClientModel::getInstance()->listClients(); 
            }
            catch (NoObjectInDatabaseException $e){
                $clientList = null;
            }
            
            $this->view = new ListBasedPage("Families");
            $this->view->addCSS('Ressources/style.css');
            $this->view->setContentTitle("Families");
            $this->view->addElement($clientList);
            $this->view->display();
            
            
         }

    }
    
}

?>
